<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;

class CreateSellDevicesTable extends Migration {

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		Schema::create('sell_devices', function(Blueprint $table)
		{
			$table->integer('id', true);
			$table->integer('purchase_device_id')->comment('关联purchase_devices表的id');
			$table->integer('customer_id')->comment('关联customers表的id');
			$table->integer('num')->default(0)->comment('购买的数量');
			$table->dateTime('sold_at')->default('1970-01-02 00:00:00')->comment('卖出日期');
			$table->string('operator', 50)->nullable()->comment('操作者，出货人');
			$table->timestamps();
		});
	}


	/**
	 * Reverse the migrations.
	 *
	 * @return void
	 */
	public function down()
	{
		Schema::drop('sell_devices');
	}

}
